package com.warmheart.builder.platform;

import com.warmheart.core.co.base.BaseCoBuilder;
import com.warmheart.core.co.oper.Co;
import com.warmheart.core.cors.enums.DateFormatEnum;
import com.warmheart.entity.platform.PlatformAccount;

/**
 * 
 * @ClassName: PlatformAccount
 * @Description: 账号实体CoBuilder类，对应表名称为tb_platform_account
 *               温馨提示：不要修改该实体CoBuilder类的任何字段
 * @author ZhangJianyang
 * @date 2025年06月16日 下午13:05:35
 *
 */
public class PlatformAccountCoBuilder extends BaseCoBuilder<PlatformAccount, PlatformAccountCoBuilder> {

    private final PlatformAccount t;

    @Override
    protected PlatformAccountCoBuilder self() {
        return this;
    }

    @Override
    public PlatformAccount core() {
        return this.t;
    }

    public PlatformAccountCoBuilder(PlatformAccount platformAccount) {
        t = platformAccount;
    }

    /**
     * 所属平台ID
     */
    private Co<PlatformAccount, PlatformAccountCoBuilder> platformId;

    /**
     * 绑定的具体资源
     */
    private Co<PlatformAccount, PlatformAccountCoBuilder> resourceId;

    /**
     * 账号类型
     */
    private Co<PlatformAccount, PlatformAccountCoBuilder> accountType;

    /**
     * 用户名
     */
    private Co<PlatformAccount, PlatformAccountCoBuilder> username;

    /**
     * 加密后的凭据
     */
    private Co<PlatformAccount, PlatformAccountCoBuilder> encryptedCredential;

    /**
     * 加密向量
     */
    private Co<PlatformAccount, PlatformAccountCoBuilder> encryptionIv;

    /**
     * 账号描述
     */
    private Co<PlatformAccount, PlatformAccountCoBuilder> description;

    /**
     * 是否激活
     */
    private Co<PlatformAccount, PlatformAccountCoBuilder> state;

    /**
     * 过期时间
     */
    private Co<PlatformAccount, PlatformAccountCoBuilder> expiresTime;

    public Co<PlatformAccount, PlatformAccountCoBuilder> platformId() {
        if (this.platformId == null) {
            this.platformId = new Co<PlatformAccount, PlatformAccountCoBuilder>(self(), "platform_id");
        }
        return this.platformId;
    }

    public Co<PlatformAccount, PlatformAccountCoBuilder> resourceId() {
        if (this.resourceId == null) {
            this.resourceId = new Co<PlatformAccount, PlatformAccountCoBuilder>(self(), "resource_id");
        }
        return this.resourceId;
    }

    public Co<PlatformAccount, PlatformAccountCoBuilder> accountType() {
        if (this.accountType == null) {
            this.accountType = new Co<PlatformAccount, PlatformAccountCoBuilder>(self(), "account_type");
        }
        return this.accountType;
    }

    public Co<PlatformAccount, PlatformAccountCoBuilder> username() {
        if (this.username == null) {
            this.username = new Co<PlatformAccount, PlatformAccountCoBuilder>(self(), "username");
        }
        return this.username;
    }

    public Co<PlatformAccount, PlatformAccountCoBuilder> encryptedCredential() {
        if (this.encryptedCredential == null) {
            this.encryptedCredential = new Co<PlatformAccount, PlatformAccountCoBuilder>(self(), "encrypted_credential");
        }
        return this.encryptedCredential;
    }

    public Co<PlatformAccount, PlatformAccountCoBuilder> encryptionIv() {
        if (this.encryptionIv == null) {
            this.encryptionIv = new Co<PlatformAccount, PlatformAccountCoBuilder>(self(), "encryption_iv");
        }
        return this.encryptionIv;
    }

    public Co<PlatformAccount, PlatformAccountCoBuilder> description() {
        if (this.description == null) {
            this.description = new Co<PlatformAccount, PlatformAccountCoBuilder>(self(), "description");
        }
        return this.description;
    }

    public Co<PlatformAccount, PlatformAccountCoBuilder> state() {
        if (this.state == null) {
            this.state = new Co<PlatformAccount, PlatformAccountCoBuilder>(self(), "state");
        }
        return this.state;
    }

    public Co<PlatformAccount, PlatformAccountCoBuilder> expiresTime(DateFormatEnum... dateFormatEnums) {
        if (this.expiresTime == null) {
            if (dateFormatEnums != null && dateFormatEnums.length > 0) {
                this.expiresTime = new Co<PlatformAccount, PlatformAccountCoBuilder>(self(), "expires_time",
                        dateFormatEnums[0].getValue());
            } else {
                this.expiresTime = new Co<PlatformAccount, PlatformAccountCoBuilder>(self(), "expires_time",
                        DateFormatEnum.yyyy_MM_dd.getValue());
            }
        }
        return this.expiresTime;
    }
}